﻿
using System;
using System.Collections.Generic;
using System.Text;
using DevExpress.Xpo;
using Component;
namespace Component
{
    public class ProvincesDB:Base
    {
        /// <summary>
        /// public static XPCollection<Province> GetAll()
        /// </summary>
        /// <returns>XPCollection<Province></returns>
        public static XPCollection<Province> GetAll()
        {
            XPCollection<Province> _xpProvince = new XPCollection<Province>(KetNoiCSDL.session);
            return _xpProvince;
        }
        /// <summary>
        /// public static Province GetObjectByid(int id)
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static Province GetObjectByid(int id,bool admin)
        {
            XPCollection<Province> _xpProvince = new XPCollection<Province>(KetNoiCSDL.session);
            _xpProvince.Filter = FilterById(id, admin);
            if (_xpProvince.Count > 0)
            {
                return _xpProvince[0];
            }
            return null;
        }       
    }
}
